//create our state
var MainState= {
    //preload our game assets
    preload: function () {
        //preload will be called at the beginning
        game.load.image('logo','res/logo.png');
    },
    create: function () {
        //create is called after preload function
        //we set up our game,and create all sprite and something else we need at the beginning
        this.sprite=game.add.sprite(200,150,'logo');
    },
    update: function () {
        //update is called 60 times per second,because the default fps is 60
        //so we can deal with our game's logic here

        //rotate our sprite simplely
        this.sprite.angle+=1;
    }
};



//Initialising Phaser,canvas's width is 400,height is 300
//render mode is PHASER.AUTO,it also can be PHASER.CANVAS or PHASER.WEBGL
//'gameDiv' is the id of canvas's parent,the canvas is create by Phaser
var game=new Phaser.Game(400,300,Phaser.AUTO,'gameDiv');

game.state.add('main',MainState);
game.state.start('main');